using System;
using System.Globalization;
using System.Windows.Data;

namespace SMSManager.WpfClient.ValueConverters
{
	public class LoginBoolConverter : IMultiValueConverter
	{
		public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			bool isValid = !(bool) values[0]; // HasError, so reverse bool.
			if (!isValid)
			{
				return false;
			}
			if (values[1] is bool)
			{
				var isLogin = (bool) values[1];
				return !isLogin;
			}
			return false;
		}

		public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
		{
			throw new NotSupportedException();
		}
	}
}